home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 8
/
Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso
/
Aminet
/
comm
/
fido
/
MM_ScriptSet1.lha
/
MM_AutoArchive.rexx
next >
Wrap
OS/2 REXX Batch file
|
1995-08-14
|
2KB
|
67 lines
/*
** MM_AutoArchive v1.0 by Tomasz Nidecki
**
** This script allows you to automatically archive and
** delete messages selected based on a complex condition
** composed of patterns for "from", "to" and "subject" fields.
** Messages will be archived in Mail:Archive. Feel free to
** change the path to your preferences.
**
** Args: rx MM_AutoArchive.rexx <area-tag>, <from-name>, <to-name>, <subject>, <file>
*/
DELFLAG = "DEL"
address "MAILMANAGER"
BEG_STEM.count = 3
END_STEM.count = 3
BEG_STEM.0 = ''
END_STEM.0 = ''
BEG_STEM.1 = '------------------------ START OF ARCHIVED MESSAGE -------------------------'
END_STEM.1 = '------------------------- END OF ARCHIVED MESSAGE --------------------------'
BEG_STEM.2 = ''
END_STEM.2 = ''
parse arg area_tag ',' from_name ',' to_name ',' msg_subject ',' file_name
area_tag = strip(area_tag)
from_name = strip(from_name)
to_name = strip(to_name)
msg_subject = strip(msg_subject)
file_name = 'Mail:Archive/'strip(file_name)
SEP_STEM.count = 10
SEP_STEM.0 = ''
SEP_STEM.1 = '============================================================================'
SEP_STEM.2 = ' Archived by MM_AutoArchive.rexx'
SEP_STEM.3 = '----------------------------------------------------------------------------'
SEP_STEM.8 = '============================================================================'
SEP_STEM.9 = ''
log_string = 'Attempting to archive messages from ' from_name ' to ' to_name ' about ' msg_subject ' in ' area_tag ' into ' file_name '.'
MM_WriteLog 'log_string' 3
MM_SearchMsgs area_tag search_stem '"'from_name'"' '"'to_name'"' '"'msg_subject'"' !SENT
DO msg_num=0 FOR search_stem.count
MM_ReadMsg area_tag search_stem.msg_num read_stem
SEP_STEM.4 = 'From:' read_stem.from ' ' read_stem.fromaddr
SEP_STEM.5 = 'To: ' read_stem.to ' ' read_stem.toaddr
SEP_STEM.6 = 'Subj:' read_stem.subj
SEP_STEM.7 = 'Date:' read_stem.date ' Flags: ' read_stem.flags
MM_WriteStem file_name SEP_STEM 'APPEND'
MM_WriteStem file_name BEG_STEM 'APPEND'
MM_WriteStem file_name read_stem.text 'APPEND'
MM_WriteStem file_name END_STEM 'APPEND'
MM_EditMsgFlags area_tag search_stem.msg_num 'delflag'
log_string = 'Archived message #' search_stem.msg_num
MM_WriteLog 'log_string' 3
END
MM_CleanArea area_tag
log_string = 'Finished archiving messages.'
MM_WriteLog 'log_string' 3